import React, { useRef, useState } from 'react';
import { useAccess, useModel } from '@umijs/max';
import { DrawerForm, ModalForm, PageContainer, ProCard, ProForm, ProFormDatePicker, ProFormDateTimePicker, ProFormInstance, ProFormTextArea } from '@ant-design/pro-components';
import { Button, Typography, message } from 'antd';
import {
    ExclamationCircleOutlined,
    CheckCircleOutlined,
} from '@ant-design/icons';
interface AddLinkageProps {
    record: MonitorLinkageData.LinkagePage;
    onClose: () => void;
    type: 'botton' | 'text'
}
export const Pass: React.FC<AddLinkageProps> = ({ onClose, type, record }) => {
    return <>
        <ModalForm
            key={'modal_form_add_submit'}
            title={
                <>
                    <CheckCircleOutlined
                        style={{
                            marginRight: 8,
                            color: '#87D068'
                        }}
                    />
                    是否通过
                </>
            }
            trigger={type === 'text' ? <a>通过</a> : <Button type='primary'>通过</Button>}
            autoFocusFirstInput
            modalProps={{
                width: 400,
                destroyOnClose: true,
            }}
            onOpenChange={(visible) => {
                if (visible) {

                } else {
                    onClose()
                }
            }}
            submitTimeout={2000}
            submitter={{
                submitButtonProps: {
                    type: 'primary',
                    style: { background: '#87d068' },
                },
            }}
            onFinish={async (val) => {
                // props.submit();
                console.log(val);
                return true;
            }}
        >
            <Typography.Paragraph>
                <blockquote>通过，以下是备注</blockquote>
            </Typography.Paragraph>
            <ProFormTextArea
                name="remarks"
                label={
                    <span
                        style={{
                            marginLeft: 11,
                        }}
                    >
                        备注
                    </span>
                }
                width="xl"
                fieldProps={{
                    rows: 6,
                    allowClear: true,
                    maxLength: 50000,
                    placeholder: '请输入通过备注（支持换行输入）',
                    showCount: true,
                }}
            />

        </ModalForm>
    </>;
};
export const Return: React.FC<AddLinkageProps> = ({ onClose, type, record }) => {
    return <>
        <ModalForm
            key={'modal_form_add_submit'}
            title={
                <>
                    <ExclamationCircleOutlined
                        style={{
                            marginRight: 8,
                            color: 'red'
                        }}
                    />
                    是否退回
                </>
            }
            trigger={type === 'text' ? <a>退回</a> : <Button type='primary'>退回</Button>}
            autoFocusFirstInput
            modalProps={{
                width: 400,
                destroyOnClose: true,
            }}
            submitTimeout={2000}
            submitter={{
                submitButtonProps: {
                    type: 'primary',
                    style: { background: '#87d068' },
                },
            }}
            onOpenChange={(visible) => {
                if (visible) {

                } else {
                    onClose()
                }
            }}
            onFinish={async (val) => {
                // props.submit();
                console.log(val);
                return true;
            }}
        >
            <Typography.Paragraph>
                <blockquote>退回，以下是描述</blockquote>
            </Typography.Paragraph>
            <ProFormTextArea
                name="remarks"
                label={
                    <span
                        style={{
                            marginLeft: 11,
                        }}
                    >
                        描述
                    </span>
                }
                width="xl"
                fieldProps={{
                    rows: 6,
                    allowClear: true,
                    maxLength: 50000,
                    placeholder: '请输入退回描述（支持换行输入）',
                    showCount: true,
                }}
            />

        </ModalForm>
    </>;
};
export const Miscalculation: React.FC<AddLinkageProps> = ({ onClose, type, record }) => {
    return <>
        <ModalForm
            key={'modal_form_add_submit'}
            title={
                <>
                    <ExclamationCircleOutlined
                        style={{
                            marginRight: 8,
                            color: 'orange'
                        }}
                    />
                    是否误判
                </>
            }
            onOpenChange={(visible) => {
                if (visible) {

                } else {
                    onClose()
                }
            }}
            trigger={type === 'text' ? <a>误判</a> : <Button type='primary' danger>误判</Button>}
            autoFocusFirstInput
            modalProps={{
                width: 400,
                destroyOnClose: true,
            }}
            submitTimeout={2000}
            submitter={{
                submitButtonProps: {
                    type: 'primary',
                    style: { background: '#87d068' },
                },
            }}
            onFinish={async (val) => {
                // props.submit();
                console.log(val);
                return true;
            }}
        >
            <Typography.Paragraph>
                <blockquote>误判，重新审核，以下是描述</blockquote>
            </Typography.Paragraph>
            <ProFormTextArea
                name="remarks"
                label={
                    <span
                        style={{
                            marginLeft: 11,
                        }}
                    >
                        描述
                    </span>
                }
                width="xl"
                fieldProps={{
                    rows: 6,
                    allowClear: true,
                    maxLength: 50000,
                    placeholder: '请输入误判理由描述（支持换行输入）',
                    showCount: true,
                }}
            />

        </ModalForm>
    </>;
};